<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.1.0/axios.js"></script>
    <title>前端</title>
</head>
<body>
    <div id = app>
        {{name}}
        <button v-on:click='get_data'>获取数据</button>
        <ul>
            <li v-for='data in data_list'>
                {{data.btitle}}
                {{data.bread}}
            </li>
        </ul>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                name:'python',
                data_list:[]
            },
            methods:{
                get_data:function(){
                    // axios get方法发送get请求
                    axios.get('http://192.168.130.32:8000')
                    // 处理成功信息
                    .then((response) => {
                        this.data_list = response.data_list
                    })
                    // 处理失败信息
                    .catch((error) => {
                        alert('获取失败')
                    })
                }
            }

        })
    </script>
</body>
</html>